Hello All, I have requirement in which i got stuck in. I need to clear the value of the attribute "Date" if the value of other attribute ("Type" && "Value") are changed since the attribute "Date" value has been filled in. Here is the code I am playing with:
//This function activates the trigger to clear the date attribute Please help. I am not sure how to modify the code to suit the requirement. KBSri - Thu Apr 24 04:27:13 EDT 2014 |
Re: Trigger to clear the attribute value to check whether other attribute values are changed after modifying the attribute It would help if you told us the specific errors you are getting. Do I read this correctly? If the user is changing attribute "Type" to the value "Implemented" then you want to erase the value of "Review Date" if it is not already ereased and the user confirms it? [] I would either print clearReviewDateDXLCode; or put it in a Notepad file and "readFile()" to get it into the code; while debugging. But that's because I cannot visuallize escaping with slashes the slashes and quotes. [] At the bottom where you "infoBox", I think you want this:
[] Add slashes to this line:
[] This looks bad: if((clear_review_date_flag == 1) && (!null(ad = find(current Module,\"Review Date\")))). How about
[] I think you need parens. I'd add sub-drectory slashes:
-Louie On other news
|
Re: Trigger to clear the attribute value to check whether other attribute values are changed after modifying the attribute llandale - Thu Apr 24 10:23:05 EDT 2014 It would help if you told us the specific errors you are getting. Do I read this correctly? If the user is changing attribute "Type" to the value "Implemented" then you want to erase the value of "Review Date" if it is not already ereased and the user confirms it? [] I would either print clearReviewDateDXLCode; or put it in a Notepad file and "readFile()" to get it into the code; while debugging. But that's because I cannot visuallize escaping with slashes the slashes and quotes. [] At the bottom where you "infoBox", I think you want this:
[] Add slashes to this line:
[] This looks bad: if((clear_review_date_flag == 1) && (!null(ad = find(current Module,\"Review Date\")))). How about
[] I think you need parens. I'd add sub-drectory slashes:
-Louie On other news
Hello Louie, Thanks .Your suggestions are always helpful and invaluable.It would make me to code better day by day. I should have more clear with the requirement. The Review Date attribute must be cleared if the attribute value " Type" and other value of the attribute "Value" is modified or changed since the "Review Date" attribute is filled in.
|
Re: Trigger to clear the attribute value to check whether other attribute values are changed after modifying the attribute KBSri - Thu Apr 24 13:28:57 EDT 2014 Hello Louie, Thanks .Your suggestions are always helpful and invaluable.It would make me to code better day by day. I should have more clear with the requirement. The Review Date attribute must be cleared if the attribute value " Type" and other value of the attribute "Value" is modified or changed since the "Review Date" attribute is filled in.
If you are triggering on a change to either of these attributes, then we can presume that change happens after any previous change to the Review Date attribute. So we don't need to examine History. If you get a qualifying change then erase Review Date if it has a value. So you want to erase the object's value of "Review Date" when the module is somewhere underneath one of your two folders the value of attributes "Type" or "Value" changes to something other than "Implemented". The problem with the generic trigger is that it will fire for EVERY obj-attr change you make in the project which can be annoying. Since you have two Attributes, either have 2 triggers (changed the way I said) or do it your way and dynamically see of the Attribute qualifies. That would look like:
If you ignore my suggestion for a "confirm", then change the "infoBox" text; attr value "is" erased. Also, perhaps this, to prevent "infoBox" when DXL is changing the values:
Give it a whirl. -Louie |
Re: Trigger to clear the attribute value to check whether other attribute values are changed after modifying the attribute llandale - Thu Apr 24 15:22:32 EDT 2014 If you are triggering on a change to either of these attributes, then we can presume that change happens after any previous change to the Review Date attribute. So we don't need to examine History. If you get a qualifying change then erase Review Date if it has a value. So you want to erase the object's value of "Review Date" when the module is somewhere underneath one of your two folders the value of attributes "Type" or "Value" changes to something other than "Implemented". The problem with the generic trigger is that it will fire for EVERY obj-attr change you make in the project which can be annoying. Since you have two Attributes, either have 2 triggers (changed the way I said) or do it your way and dynamically see of the Attribute qualifies. That would look like:
If you ignore my suggestion for a "confirm", then change the "infoBox" text; attr value "is" erased. Also, perhaps this, to prevent "infoBox" when DXL is changing the values:
Give it a whirl. -Louie Thanks as always Louie. But i tried your solution for this. I am not able to erase the Review Date value if the value of attributes "Value" or "Type" is changed since the value of "Review Date" is modified. if (null ad || !((ad.name == \"Value\") || (ad.name == \"Value\"))) if (null ad || !((ad.name == \"Type\") || (ad.name == \"Type\"))) Sorry you have ignore the word "Implemented". This can be of any data which is modified. A trigger shall clear the "Review Date" attribute if "Value" attribute or "Type" attribute has been modified since the review date has been filled in. Please help.
|
Re: Trigger to clear the attribute value to check whether other attribute values are changed after modifying the attribute KBSri - Mon Apr 28 10:20:47 EDT 2014 Thanks as always Louie. But i tried your solution for this. I am not able to erase the Review Date value if the value of attributes "Value" or "Type" is changed since the value of "Review Date" is modified. if (null ad || !((ad.name == \"Value\") || (ad.name == \"Value\"))) if (null ad || !((ad.name == \"Type\") || (ad.name == \"Type\"))) Sorry you have ignore the word "Implemented". This can be of any data which is modified. A trigger shall clear the "Review Date" attribute if "Value" attribute or "Type" attribute has been modified since the review date has been filled in. Please help.
I made a typo:
"A trigger shall clear the "Review Date" attribute if "Value" attribute or "Type" attribute has been modified since the review date has been filled in.". That sentance can be implemented with some on-demand script. For an object, review History for the last change to the 3 attributes and erase as needed by comparing dates. But you are correctly using a trigger for when Value or Type IS being changed. Since it is changing right now, we can easily deduce that any current value of Review Date must have been made before right now. Thus, I suggest that when Value or Type change triggers your code, that you erase Review Date, if it has a value right now. So I think it better to re-word your requirement: "A trigger shall clear the "Review Date" attribute when "Value" attribute or "Type" attribute changes.". I get the feeling that one of us fundamentally does not undestand the other. Perhaps it is this: as I read your code, it is a trigger that fires when any object attribute value changes; you want it to ignore all changes outside your folder and ignore changes to attributes that are not Value and Type. If so, then effectively the "event" for the trigger is when those attributes change; specifically before the change (thus it is a "pre" trigger). -louie
|